<template>
  <page-frame>
    <div class="review">
      <div class="toptitle">
        <div class="left padding-bottom-6">审核</div>
        <div class="right">
          <div class="btns">
            <div class="badge">
              <el-badge :value="badge.pendingReview" class="item">
                <el-button @click="pendingReview">待审核内容</el-button>
              </el-badge>
              <el-badge :value="badge.passed" class="item">
                <el-button  @click="alreadyPassed">已通过</el-button>
              </el-badge>
              <el-badge :value="badge.rejected" class="item">
                <el-button @click="alreadyReject">已拒绝</el-button>
              </el-badge>
            </div>
          </div>
        </div>
      </div>
      <div class="borderT"></div>
      <div class="file-main">
        <div class="input">
          <el-row>
            <el-col style="width: 130px;">
              <div class="input-item">
                <el-select style="width:90%!important;" v-model="fileId" @change="selectItem" @clear = "clearItem" clearable placeholder="请选择项目">
                  <el-option
                    v-for="item in fileList"
                    :label="item.fileName"
                    :value="item.fileId">
                  </el-option>
                </el-select>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="input-item" v-show="fileId=='1'">
                <el-input v-model="queryData.memberName" @keyup.enter.native="query" placeholder="请选择会员姓名">
                </el-input>
              </div>
              <div class="input-item" v-show="fileId=='3'">
                <el-date-picker
                  v-model="applicationTime"
                  type="daterange"
                  @change="selectTime"
                  placeholder="请选择审核时间">
                </el-date-picker>
              </div>
              <div class="input-item" v-show="fileId=='2'">
                <el-select v-model="queryData.actType" @change="query" placeholder="请选择审核类型">
                  <el-option
                    v-for="item in reviewTypeList"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value">
                  </el-option>
                </el-select>
              </div>
            </el-col>
            <el-col :span="2">
                <el-button class="query lightGreenBtn" @click="query">搜索</el-button>
            </el-col>

          </el-row>
        </div>
        <div class="tabs">
          <el-table
            :data="tableData"
            border
            highlight-current-row
            style="width: 100%">
            <el-table-column
              prop="operating"
              label="操作"
              width="170"
            >
              <template scope="scope">
                <el-row v-show="scope.row.status==1">
                  <el-button size="small" @click="examinationPassed(scope.row)" >审核通过</el-button>
                  <el-button size="small" @click="rejectBtn(scope.row)" >拒绝</el-button>
                </el-row>
                <el-button size="small" v-show="scope.row.status==2" :disabled="true">已通过</el-button>
                <el-button size="small" v-show="scope.row.status==3" :disabled="true">已拒绝</el-button>
              </template>
            </el-table-column>
            <el-table-column
              prop="approvalTypeName"
              label="审核类型"
              width="140"
            >
            </el-table-column>
            <el-table-column
              prop="memberNo"
              label="会员编号"
              width="120"
            >
            </el-table-column>
            <el-table-column
              prop="memberName"
              label="会员姓名"
              width="120"
            >
            </el-table-column>
            <el-table-column
              prop="phone"
              label="联系方式"
              width="170"
            >
            </el-table-column>
            <el-table-column
              prop="bed"
              label="床位"
              width="200"
            >
            </el-table-column>
            <el-table-column
              prop="age"
              label="年龄"
            >
            </el-table-column>
            <el-table-column
              prop="commitTime"
              label="提交审核时间"
              width="170"
            >
            </el-table-column>
            <el-table-column
              prop="operating"
              label="审核参考材料"
              width="220"
            >
              <template scope="scope">
                <span v-if="scope.row.approvalTypeValue==0">
                  <el-button type="text" size="small" @click.stop="capacityAssessment(scope.row)">能力评估表</el-button>
                  <el-button type="text" size="small" @click.stop="medicalReport(scope.row)">体检报告</el-button>
                  <el-button type="text" size="small" @click.stop="personalInfo(scope.row)">个人资料</el-button>
                </span>
                <span v-if="scope.row.approvalTypeValue==1">
                  <el-button type="text" size="small" @click.stop="checkOut(scope.row)">退住申请表</el-button>
                  <el-button type="text" size="small" @click.stop="personalInfo(scope.row)">个人资料</el-button>
                </span>
                <span v-if="scope.row.approvalTypeValue==2">
                  <el-button type="text" size="small" @click.stop="changeBed(scope.row)">换床申请表</el-button>
                  <el-button type="text" size="small" @click.stop="personalInfo(scope.row)">个人资料</el-button>
                </span>
                <span v-if="scope.row.approvalTypeValue==3">
                  <el-button type="text" size="small" @click.stop="packageChange(scope.row)">变更申请表</el-button>
                  <el-button type="text" size="small" @click.stop="personalInfo(scope.row)">个人资料</el-button>
                </span>
              </template>
            </el-table-column>
          </el-table>

          <!--会员能力评估-->
          <el-dialog title="会员能力评估" :visible.sync="ability" size="tiny" :close-on-click-modal="false">
            <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
              <el-form-item label="会员姓名">
                <el-input v-model="abilityData.name" :disabled="true"></el-input>
              </el-form-item>
            </el-form>
            <div class="barTitle">
              <span class="verticalBar"></span>
              评估结果
            </div>
            <el-table
              :data="evaluationResult"
              border
              style="width: 100%;height: 400px;overflow-y: scroll;">
              <el-table-column
                prop="setName"
                label="评估项目"
                width="">
              </el-table-column>
              <el-table-column
                prop="resultValue"
                label="评估分值"
                width="">
              </el-table-column>
              <el-table-column
                prop="resultName"
                label="评估等级"
                width="">
              </el-table-column>
            </el-table>
          </el-dialog>
          <!--体检报告-->
          <el-dialog title="体检报告" :visible.sync="medical_report" size="tiny" :close-on-click-modal="false">
            <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
              <el-form-item label="员工姓名">
                <el-input v-model="formLabelAlign.name" :disabled="true"></el-input>
              </el-form-item>
            </el-form>
            <div class="download">
              <form method="get"  accept-charset="UTF-8" :action="apiUrl+'/common/annex/'+annexId">
<!--
                <input v-for="(val,key) in queryData" :name="key" :value="val" type="hidden"/>
-->
                <input type="hidden" name="access_token" :value="token" />
                <input type="hidden" name="fileType" value="zipFile">
                <input type="hidden" name="fileIds" :value="fileIds">
                <p type="submit">
                  <i class="iconfont icon-xiazai"></i>
                </p>
                <input type="submit" value="下载用户体检报告">
              </form>
            </div>
            <div class="tips">
              <label>温馨提示：</label>
              <b>请先下载到本地再查看该用户体检报告</b>
            </div>
          </el-dialog>
          <!--退住申请-->
          <el-dialog title="退住申请" :visible.sync="checkOutStatus" size="tiny" :close-on-click-modal="false">
            <el-form :label-position="checkOutlabelPosition" label-width="80px" :model="checkOutData">
              <el-form-item label="会员姓名">
                <el-input v-model="checkOutData.memberName" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="会员编号">
                <el-input v-model="checkOutData.memberNo" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="床位">
                <el-input v-model="checkOutData.bed" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="照护等级">
                <el-select v-model="checkOutData.lId" disabled>
                  <el-option
                    v-for="item in careLevelOptions"
                    :label="item.lname"
                    :value="item.lid">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="入住日期">
                <el-input v-model="checkOutData.dateInApply" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="退住日期">
                <el-input v-model="checkOutData.dateOutApply" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="退住原因">
                <el-input v-model="checkOutData.reason" :disabled="true"></el-input>
              </el-form-item>
            </el-form>
          </el-dialog>
          <!--换床申请-->
          <el-dialog title="换床申请" :visible.sync="changeBedStatus" size="tiny" :close-on-click-modal="false">
            <el-form :label-position="checkOutlabelPosition" label-width="80px" :model="changeBedData">
              <el-form-item label="会员姓名">
                <el-input v-model="changeBedData.memberName" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="会员编号">
                <el-input v-model="changeBedData.memberNo" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="照护等级">
                <el-select v-model="changeBedData.lId" disabled>
                  <el-option
                    v-for="item in careLevelOptions"
                    :label="item.lname"
                    :value="item.lid">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="入住日期">
                <el-input v-model="changeBedData.dateInApply" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="原床位">
                <el-input v-model="changeBedData.oldBed" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="新床位">
                <el-input v-model="changeBedData.newBed" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="换床原因">
                <el-input v-model="changeBedData.reason" :disabled="true"></el-input>
              </el-form-item>
            </el-form>
          </el-dialog>
          <!--个人资料-->
          <el-dialog title="个人资料" :visible.sync="personalInfoStatus" size="small" :close-on-click-modal="false">
            <div class="personalInfo" style="vertical-align: top">
              <el-form :model="personalInfoData" ref="personalInfoData" label-width="100px">
                <!--基本信息-->
                <div class="panel">
                  <div class="panel-title" style="margin-top:15px!important;">
                    <el-row :gutter="20">
                      <el-col :span="6">
                        <div class="grid-content bg-purple">基本信息</div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="panel-content">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="姓名">
                          <el-input v-model="personalInfoData.member.memberName" disabled></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12" style="position:relative;">
                        <el-upload
                          class="avatar-uploader"
                          action="https://jsonplaceholder.typicode.com/posts/"
                          :show-file-list="false"
                          disabled
                          :on-success="handleAvatarSuccess"
                          :before-upload="beforeAvatarUpload">
                          <img v-if="imageUrl" :src="imageUrl" class="avatar">
                          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                        </el-upload>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="性别">
                          <template scope="scope">
                            <el-radio-group v-model="personalInfoData.member.gender">
                              <el-radio :label="0" disabled>男</el-radio>
                              <el-radio :label="1" disabled>女</el-radio>
                            </el-radio-group>
                          </template>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12"></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="身份证号">
                          <el-input v-model="personalInfoData.member.cardno" disabled></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12"></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="出生日期">
                          <el-date-picker
                            v-model="personalInfoData.member.birthday"
                            type="date"
                            disabled
                            placeholder="选择日期">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12"></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="移动电话">
                          <el-input v-model="personalInfoData.member.phone" disabled></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12"></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="固定电话">
                          <el-input v-model="personalInfoData.member.tel" disabled></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12"></el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="会员类型">
                          <el-select v-model="personalInfoData.member.type" placeholder="请选择会员等级" disabled>
                            <el-option label="外部会员" value="1">外部会员</el-option>
                            <el-option label="入住会员" value="2">入住会员</el-option>
                            <el-option label="入住会员" value="0">入住会员</el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="会员编号">
                          <el-input v-model="personalInfoData.member.memberNo" disabled></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="入住时间">
                          <el-date-picker
                            v-model="personalInfoData.member.dateCheckin"
                            type="date"
                            placeholder="选择日期"
                            disabled
                          >
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="床位">
                          <el-input v-model="personalInfoData.member.bedNo" disabled></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="照护等级">
                          <el-select v-model="personalInfoData.member.lid" disabled>
                            <el-option
                              v-for="item in careLevelOptions"
                              :label="item.lname"
                              :value="item.lid">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="居住地址">
                          <el-input v-model="personalInfoData.member.addressLive" disabled></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="户籍地址">
                          <el-input v-model="personalInfoData.member.addressPermanent" disabled></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="民族">
                          <el-input v-model="personalInfoData.member.nation" disabled></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="籍贯">
                          <el-input v-model="personalInfoData.member.nativePlace" disabled></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="政治面貌">
                          <el-select v-model="personalInfoData.member.politics" placeholder="请选择政治面貌" disabled>
                            <el-option label="中共党员" value="1">中共党员</el-option>
                            <el-option label="共青团员" value="2">共青团员</el-option>
                            <el-option label="群众" value="3">群众</el-option>
                            <el-option label="其他党派" value="4">其他党派</el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="宗教信仰">
                          <el-input v-model="personalInfoData.member.faith" disabled></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="婚姻状况">
                          <el-select v-model="personalInfoData.member.marriage" placeholder="请选择婚姻状况" disabled>
                            <el-option label="单身" value="1">单身</el-option>
                            <el-option label="已婚" value="2">已婚</el-option>
                            <el-option label="离异" value="3">离异</el-option>
                            <el-option label="丧偶" value="4">丧偶</el-option>
                            <el-option label="其他" value="5">其他</el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="文化程度">
                          <el-select v-model="personalInfoData.member.education" placeholder="请选择文化程度" disabled>
                            <el-option label="博士" value="1">博士</el-option>
                            <el-option label="硕士" value=2>硕士</el-option>
                            <el-option label="本科" value="3">本科</el-option>
                            <el-option label="大专" value="4">大专</el-option>
                            <el-option label="中专和中技" value="5">中专和中技</el-option>
                            <el-option label="技工学校" value="6">技工学校</el-option>
                            <el-option label="高中" value="7">高中</el-option>
                            <el-option label="初中" value="8">初中</el-option>
                            <el-option label="小学" value="9">小学</el-option>
                            <el-option label="文盲与半文盲" value="10">文盲与半文盲</el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </div>
                </div>
                <!--亲属信息-->
                <div class="panel">
                  <div class="panel-title">亲属信息
                  </div>
                  <div class="panel-content">
                    <el-row>
                      <el-col :span="22">
                        <el-table
                          :data="relationInfoData"
                          border
                          max-height="361">
                          <el-table-column
                            prop="contactName"
                            label="姓名"
                            width="">
                          </el-table-column>
                          <el-table-column
                            prop="genderName"
                            label="性别"
                            width="">
                          </el-table-column>
                          <el-table-column
                            prop="relationName"
                            label="关系">
                          </el-table-column>
                          <el-table-column
                            prop="phone"
                            width="150"
                            label="联系电话">
                          </el-table-column>
                          <el-table-column
                            prop="isUrgentName"
                            label="紧急联系人"
                            width="120">
                          </el-table-column>
                          <el-table-column
                            prop="address"
                            label="通讯地址"
                            width="150">
                          </el-table-column>
                          <el-table-column
                            label="操作"
                            width="120"
                            v-if="addMember"
                          >
                            <template scope="scope">
                              <el-button type="text" size="small" @click.stop="editRelatives">修改</el-button>
                              <el-button type="text" size="small" @click.stop="delRelatives">删除</el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                      </el-col>
                    </el-row>
                  </div>
                </div>
                <!--其他-->
                <div class="panel others">
                  <div class="panel-title">其他</div>
                  <div class="panel-content">
                    <el-row>
                      <el-form-item label="兴趣爱好:">
                        <span v-for="item in personalInfoData.hobbyList">{{item}}</span>
                      </el-form-item>
                      <el-form-item label="工作经历:">
                        <div v-model="personalInfoData.member.workExper">{{personalInfoData.member.workExper}}</div>
                      </el-form-item>
                      <el-form-item label="备注:">
                        <div v-model="personalInfoData.member.remark">{{personalInfoData.member.remark}}</div>
                      </el-form-item>
                    </el-row>
                  </div>
                </div>
              </el-form>
            </div>
          </el-dialog>
          <!--套餐变更申请-->
          <el-dialog title="套餐变更申请" :visible.sync="packageChangeStatus" size="tiny" :close-on-click-modal="false">
            <el-form :label-position="checkOutlabelPosition" label-width="80px" :model="packageChangeData">
              <el-form-item label="会员姓名">
                <el-input v-model="packageChangeData.memberName" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="会员编号">
                <el-input v-model="packageChangeData.memberNo" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="照护等级">
                <el-select v-model="packageChangeData.lId" disabled>
                  <el-option
                    v-for="item in careLevelOptions"
                    :label="item.lname"
                    :value="item.lid">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="入住日期">
                <el-input v-model="packageChangeData.dateInApply" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="床位">
                <el-input v-model="packageChangeData.bed" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="现套餐等级">
                <el-input v-model="packageChangeData.oldLevel" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="变更后套餐等级">
                <el-input v-model="packageChangeData.newLevel" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="变更原因">
                <el-input v-model="packageChangeData.reason" :disabled="true"></el-input>
              </el-form-item>
            </el-form>
          </el-dialog>
          <div class="pagination">
            <div class="block">
              <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChangePage"
                :current-page="currentPage"
                :page-size="10"
                layout="total, prev, pager, next"
                :total="total">
              </el-pagination>
            </div>
          </div>
        </div>
      </div>
      <!--拒绝原因-->
      <el-dialog title="拒绝原因" :visible.sync="reasonRefusal" size="tiny" :close-on-click-modal="false">
        <el-form>
          <el-form-item label="拒绝原因">
            <el-col :span="18">
              <el-input v-model="refuseReason"></el-input>
            </el-col>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="reasonRefusal = false">取 消</el-button>
          <el-button type="primary" @click="reject">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </page-frame>
</template>

<script>
  import reviewApi from '../../service/member/reviewApi';
  import commonApi from '../../service/member/commonApi';
  import {apiUrl} from '../../config/env';
  export default {
    data() {
      return {
        fileId:1,
        apiUrl,
        annexId: '',
        token: window.sessionStorage.getItem("access_token"),
        fileIds: '',
        badge:{
          pendingReview:0,
          passed:0,
          rejected:0
        },
        addMember:false,
        date:'',
        imageUrl: '',
        form:{},
        relationInfoData:[],
        refuseReason: '',
        reasonRefusal:false,
        personalInfoData: {
          member:{
            memberName:'',
            gender:null,
            cardno:'',
            birthday:'',
            phone:'',
            tel:'',
            type:null,
            memberNo:'',
            dateCheckin:'',
            bedNo:'',
            lid:null,
            addressLive:'',
            addressPermanent:'',
            nation:'',
            nativePlace:'',
            politics:null,
            faith:null,
            marriage:null,
            education:null,
            workExper:'',
            remark:''
          },
          contactList:[{
            contactName:'',
            gender:1,
            relation:null,
            phone:'',
            isUrgent:null,
            address:'',
          }],
          hobbyList:[],
        },
        careLevelOptions:[],
        personalInfoStatus:false,
        changeBedStatus:false,
        checkOutStatus:false,
        packageChangeStatus:false,
        ability:false,
        medical_report:false,
        labelPosition: 'left',
        checkOutlabelPosition:'right',
        abilityData:{
          name:'',
        },
        formLabelAlign: {
          name: '',
        },
        checkOutData:{
          memberName:"",
          memberNo:"",
          bed:"",
          lId:"",
          dateInApply:"",
          dateOutApply:"",
          reason:""
        },
        changeBedData:{
          memberName:"",
          memberNo:"",
          lId:"",
          dateInApply:"",
          oldBed:"",
          newBed:"",
          reason:""
        },
        packageChangeData:{
          memberName:"",
          memberNo:"",
          lId:"",
          dateInApply:"",
          bed:"",
          oldLevel:"",
          newLevel:'',
          reason:""
        },
        queryData:{
          actType: null,
          dateEnd: "",
          dateStart: "",
          memberName: "",
          status: null
        },
        applicationTime:[],
        fileList:[{
          fileId: 1,
          fileName: "会员姓名"
        },{
          fileId: 2,
          fileName: "审核类型",
        },{
          fileId: 3,
          fileName: "提交审核时间",
        }],
        reviewTypeList:[{
          "value": 0,
          "name": "入住审批"
        },{
          "value": 1,
          "name": "退住审批"
        },{
          "value": 3,
          "name": "套餐变更审批"
        },{
          "value": 2,
          "name": "换床审批"
        }],
        evaluationResult:[],
        tableData: [],
        total:0,
        currentPage: 1,
        currentLogId:""
      }
    },
    methods: {
      init(){
        this.loadTableData();
        this.getApprovalsTypes();
        this.getAllCountsByType();
        this.getCareLevel();
      },
      /**
       * 选择项目
       */
      selectItem(){
        //清空选项
        this.queryData.actType = null;
        this.queryData.dateEnd='';
        this.queryData.dateStart='';
        this.queryData.memberName='';
        this.queryData.status = null;
      },
      /**
       * 清空按钮触发
       */
      clearItem(){
        this.selectItem();
      },
      /**
       * 获取审批类型
       */
      getApprovalsTypes(){
        let self = this;
        reviewApi.getApprovalWay().then(
          (response)=>{
            self.reviewTypeList = response.data.data;
          }
        );
      },
      getAllCountsByType(){
         let self = this;
        reviewApi.getAllCountsByType().then(
          (response)=>{
             self.badge.pendingReview=response.data.data.pendingReviewCounts;
             self.badge.passed = response.data.data.passedCounts;
             self.badge.rejected = response.data.data.rejectedCounts;
          }
        );
      },
      /**
       * 加载表格数据
       */
      loadTableData(){
        let self = this;
        if(self.applicationTime==[]||self.applicationTime[0]==null&&self.applicationTime[1]==null){
          //如果时间为空
          self.queryData.dateStart='';
          self.queryData.dateEnd='';
        }else{
          self.queryData.dateStart = self.applicationTime[0];
          self.queryData.dateEnd = self.applicationTime[1];
        }
        reviewApi.auditQuery(10,self.currentPage,self.queryData).then(
          (response)=>{
            self.tableData = response.data.data.list;
            self.total = response.data.data.total;
          }
        );
      },
      /**
       * 搜索  分页查询
       */
      query(){
        //如果搜索数据为空，将status置为0
        if(this.queryData.actType==null&&this.queryData.dateEnd==''&&this.queryData.dateStart==''&&this.queryData.memberName==''){
          this.queryData.status=0;
        }
        this.loadTableData();
      },
      /**
       * 点击"待审核内容"图标
       */
      pendingReview(){
        this.queryData.status=1;
        this.loadTableData();
      },
      /**
       * 点击"已通过"图标
       */
      alreadyPassed(){
        this.queryData.status=2;
        this.loadTableData();
      },
      /**
       * 点击"已拒绝"图标
       */
      alreadyReject(){
        this.queryData.status=3;
        this.loadTableData();
      },
      /**
       * 点击"审核通过"操作
       */
      examinationPassed(row){
        let self = this;
        reviewApi.approvalsAccept(row.logId).then(
          (response)=>{
            self.loadTableData();
            self.getAllCountsByType();
            self.$message({
              message: '审核通过',
              type: 'success'
            });
          }
        );
      },
      /**
       * 点击"拒绝"操作
       */
      rejectBtn(row){
       this.currentLogId  =  "";
       this.currentLogId  =  row.logId;
        this.reasonRefusal = true;
      },
      reject(){
        let self = this;
        this.reasonRefusal = false;
        reviewApi.approvalsReject(self.currentLogId,self.refuseReason).then(
          (response)=>{
            self.refuseReason="";
            self.loadTableData();
            self.getAllCountsByType();
            self.$message({
              message: '审核拒绝',
              type: 'success'
            });
          }
        );
      },
      /**
       * 能力评估表
       */
      capacityAssessment(row){
        this.ability = true;
//        let sheetType = row.sheetType;
        let sheetType = 1;//暂时写死的
        let memberId = row.memberId;
        this.abilityData.name = row.memberName;
        reviewApi.getCapacityAssessmentForm(sheetType,memberId).then(
          (response)=>{
            this.evaluationResult = response.data.data;
          }
        );
      },
      /**
       * 体检报告
       */
      medicalReport(row){
        this.medical_report = true;
        reviewApi.medicalReport(row.actId).then(
          (response)=>{
             this.formLabelAlign.name =  row.memberName;
             this.annexId = response.data.data[0].annexId;
             var fileIdStr = '';
             for(var i=0;i<response.data.data.length;i++){
               if(fileIdStr==''){
                 fileIdStr = response.data.data[i].annexId;
               }else{
                 fileIdStr = fileIdStr+","+response.data.data[i].annexId;
               }
             }
             this.fileIds = fileIdStr;
          }
        );
      },
      /**
       * 个人资料
       */
      personalInfo(row){
        let self = this;
        self.personalInfoStatus = true;
        reviewApi.getPersonalInfo(row.memberId).then(
          (response)=>{
            self.personalInfoData = response.data.data;
            self.relationInfoData = self.personalInfoData.contactList;
            self.personalInfoData.member.bedNo = row.bed;
            self.imageUrl = self.personalInfoData.member.bigAvatar+"?access_token="+ window.sessionStorage.getItem("access_token");
            for(let i=0;i<self.relationInfoData.length;i++){
              //性别
              if(self.relationInfoData[i].gender==0){
                self.relationInfoData[i].genderName = '男';
              }else if(self.relationInfoData[i].gender==1){
                self.relationInfoData[i].genderName = '女';
              }
              //关系
              if(self.relationInfoData[i].relation==0){
                self.relationInfoData[i].relationName='父母子女关系';
              }else if(self.relationInfoData[i].relation==1){
                self.relationInfoData[i].relationName='亲友关系';
              }else if(self.relationInfoData[i].relation==2){
                self.relationInfoData[i].relationName='夫妻关系';
              }else if(self.relationInfoData[i].relation==3){
                self.relationInfoData[i].relationName='其他';
              }
              //紧急联系人
              if(self.relationInfoData[i].isUrgent==1){
                self.relationInfoData[i].isUrgentName = '是';
              }else if(self.relationInfoData[i].isUrgent==0){
                self.relationInfoData[i].isUrgentName = '否';
              }
            }
          }
        );
      },
      /**
       * 获得照护等级
       */
      getCareLevel(){
        commonApi.getCareGrade().then(
          (response)=>{
            this.careLevelOptions = response.data.data;
          }
        );
      },
      /**
       * 换床申请表
       */
      changeBed(row){
        this.changeBedStatus = true;
        commonApi.getChangeBedApplicationForm(row.actId).then(
          (response)=>{
            this.changeBedData = response.data.data;
          }
        );
      },
      /**
       * 退住申请表
       */
      checkOut(row){
        this.checkOutStatus = true;
        commonApi.getRetirementApplicationForm(row.actId).then(
          (response)=>{
            this.checkOutData = response.data.data;
            this.checkOutData.dateInApply = this.checkOutData.dateInApply.substring(0,10);
            this.checkOutData.dateOutApply = this.checkOutData.dateOutApply.substring(0,10);
          }
        );
      },
      /**
       * 套餐变更申请表
       */
      packageChange(row){
        this.packageChangeStatus = true;
        commonApi.getMemberComboChange(row.actId).then(
          (response)=>{
            if(response.data.status==200){
              this.packageChangeData = response.data.data;
            }
          }
        );
      },
      //头像上传
      handleAvatarSuccess(res, file) {
        this.imageUrl = URL.createObjectURL(file.raw);
      },
      beforeAvatarUpload(file) {
        const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;

        if (!isJPG) {
          this.$message.error('上传头像图片只能是 JPG 格式!');
        }
        if (!isLt2M) {
          this.$message.error('上传头像图片大小不能超过 2MB!');
        }
        return isJPG && isLt2M;
      },
      //分页函数
      handleSizeChange(val) {
//        console.log(`每页 ${val} 条`);
      },
      handleCurrentChangePage(val) {
        this.currentPage = val;
//        console.log(`当前页: ${val}`);
        this.loadTableData();
      },
      /**
       * 搜索时改变时间筛选项
       */
      selectTime(val){
        //console.log(val);//val = "2017-06-12 - 2017-06-15"
        this.queryData.startDateStart = val.substring(0,10).replace(/\-/g,' ');
        this.queryData.startDateEnd = val.substring(13).replace(/\-/g,' ');
        this.loadTableData();
      },
    },
    mounted: function () {
      this.init();
    },
  }
</script>
<style>

  .input .btns{
    float:none!important;
    display:inline-block;
  }
  .input input{
    display: inline-block;
  }
  .el-pagination{
    margin-right:0!important;
    padding-right:0!important;
  }
  .el-select {
    display: block;
    position: relative;
  }
  .el-dialog .barTitle{
    font-size:14px;
    vertical-align:middle;
    margin-bottom:7px;
  }
  .el-dialog .barTitle .verticalBar{
    background-color:#0cb7c6;
    height:20px;
    width:2px;
    display:inline-block;
    vertical-align:middle;
  }
  .el-dialog .download{
    text-align:center;
  }
  .el-dialog .tips{
    margin-top:20px;
  }
  .el-dialog .download i{
    font-size:60px;
    /*cursor:pointer;*/
  }
  .review .el-dialog .avatar-uploader{
    border-radius: 6px;
    cursor: pointer;
    position: absolute;
    top:5px;
    left: 120px;
    z-index: 5;
    height: 234px;
  }
  .review .el-dialog .avatar-uploader .el-upload:hover {
    border-color: #20a0ff;
  }
  .review .el-dialog .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 234px;
    line-height: 234px;
    text-align: center;
  }
  .review .el-dialog .avatar {
    width: 178px;
    height: 234px;
    display: block;
  }
  .el-dialog .personalInfo .panel-content{
    position:relative;
  }

  /*Badge标记*/
  .review .badge{
    /*position: absolute;*/
    /*top: 25px;*/
    /*right: 30px;*/
    /*z-index: 12;*/
    margin-top: 10px;
  }
  .review .badge .item{
    margin-right:30px;
  }

  /*others*/
  .review .others .el-form-item__content span{
    margin-right:5px;
  }
  .review .others .el-form-item{
    margin-bottom:0px;
  }
  .review .tabs .el-button+.el-button{
    margin-left:0;
  }
</style>


